<?php

namespace app\common\model\jy;

class OrderRefundLog extends CUBase {
	protected $append = [];

	public function getImagesAttr($value, $data) {
		$iids = loadModel('jy\\OrderRefundLogImageNexus')->where(['orlid' => $data['id']])->column('iid');
		if(empty($iids)) {
			return [];
		}
		return loadModel('tysj\\Image')->whereIn('id', $iids)->select();
	}

	public function getImagesUrlAttr($value, $data) {
		$iids = loadModel('jy\\OrderRefundLogImageNexus')->where(['orlid' => $data['id']])->column('iid');
		if(empty($iids)) {
			return [];
		}
		return loadModel('tysj\\Image')->whereIn('id', $iids)->column('url');
	}

	public function getTypeTextAttr($value, $data) {
		$type = $data['type'];
		$options = loadEnum('OrderRefundLogType')->get_options();
		if(isset($options[$type])) {
			return $options[$type];
		} else {
			return '其它';
		}
	}
}
